package com.xinke.module.system.mapper.user;

import java.util.*;

import com.xinke.component.common.pojo.PageResult;
import com.xinke.component.mybatis.mybatis.core.query.LambdaQueryWrapperExt;
import com.xinke.component.mybatis.mybatis.core.mapper.BaseMapperExt;
import com.xinke.module.system.model.entity.user.AdminUserDO;
import com.xinke.module.system.model.entity.user.PostDO;
import org.apache.ibatis.annotations.Mapper;
import com.xinke.module.system.model.vo.user.*;

/**
 * 岗位信息 Mapper
 *
 * @author yzx
 */
@Mapper
public interface PostMapper extends BaseMapperExt<PostDO> {

    default List<PostDO> selectList(Collection<Long> ids, Collection<Integer> statuses) {
        return selectList(new LambdaQueryWrapperExt<PostDO>()
                .inIfPresent(PostDO::getPostId, ids)
                .inIfPresent(PostDO::getPostStatus, statuses));
    }

    default PageResult<PostDO> selectPage(PostPageReqVO reqVO, Collection<Long> deptIds) {
        return selectPage(reqVO, new LambdaQueryWrapperExt<PostDO>()
                .eqIfPresent(PostDO::getPostCode, reqVO.getPostCode())
                .inIfPresent(PostDO::getDeptId, deptIds)
                .likeIfPresent(PostDO::getPostName, reqVO.getPostName())
                .eqIfPresent(PostDO::getShowSort, reqVO.getShowSort())
                .eqIfPresent(PostDO::getPostStatus, reqVO.getPostStatus())
                .eqIfPresent(PostDO::getRemark, reqVO.getRemark())
                .orderByAsc(PostDO::getDeptId)
                .orderByAsc(PostDO::getShowSort));
    }

}